<?php
// Manages menu list
class MenuList
{
	/* Public variables available in menu_list.tpl Smarty template */
	public $mSelectedMenu = 0;
	public $mMenus;
	
	// Constructor reads query string parameter
	public function __constrcut()
	{
		// If MenuId exists in the query string, we're visiting a menu
		if (isset($_GET['MenuId']))
			$this->mSelectedMenu = (int)$_GET['MenuId'];
		
		
	}
	
	// Calls business tier method to read menus list and create their links
	public function init()
	{
		// Get the list of menus from the business tier
		$this->mMenus = Menu::GetAllMenuLinks();
		
		// Create the department links
		for ($i = 0; $i < count($this->mMenus); $i++)
			$this->mMenus[$i]['link_to_page'] = Link::ToMenu($this->mMenus[$i]['menuId']);
	} 
}
?>